Option Strict On
Option Explicit On 

Imports System.Runtime.Serialization

Public Class Presentation
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

        'Me.MdiParent = fMain
        mEditMode = [Global].EditMode.[New]
        mLayouts = New ArrayList
        mOleDbConnection = Nothing
        mPresentation = New Model10.Presentation
        mUser = Nothing

        mPresentation.Id = 0
        mPresentation.Name = GetSystemResource("New")
        mPresentation.Path = ""

        Fill()
    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
    Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
    Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
    Friend WithEvents FontDialog1 As System.Windows.Forms.FontDialog
    Friend WithEvents tbRedo As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbUndo As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbSep2 As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbPaste As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbCopy As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbCut As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbSep1 As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbSave As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbMain As System.Windows.Forms.ToolBar
    Friend WithEvents imgBlank As System.Windows.Forms.PictureBox
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents miFile As System.Windows.Forms.MenuItem
    Friend WithEvents miFileClose As System.Windows.Forms.MenuItem
    Friend WithEvents miFileBar1 As System.Windows.Forms.MenuItem
    Friend WithEvents miFileSave As System.Windows.Forms.MenuItem
    Friend WithEvents miFileSaveAs As System.Windows.Forms.MenuItem
    Friend WithEvents miFileImport As System.Windows.Forms.MenuItem
    Friend WithEvents miEdit As System.Windows.Forms.MenuItem
    Friend WithEvents miEditUndo As System.Windows.Forms.MenuItem
    Friend WithEvents miEditRedo As System.Windows.Forms.MenuItem
    Friend WithEvents miEditBar1 As System.Windows.Forms.MenuItem
    Friend WithEvents miEditCut As System.Windows.Forms.MenuItem
    Friend WithEvents miEditCopy As System.Windows.Forms.MenuItem
    Friend WithEvents miEditPaste As System.Windows.Forms.MenuItem
    Friend WithEvents miEditBar2 As System.Windows.Forms.MenuItem
    Friend WithEvents miEditRename As System.Windows.Forms.MenuItem
    Friend WithEvents miView As System.Windows.Forms.MenuItem
    Friend WithEvents miViewOpen As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar0 As System.Windows.Forms.MenuItem
    Friend WithEvents miPresentationReadRelations As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar1 As System.Windows.Forms.MenuItem
    Friend WithEvents miPresentationProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar2 As System.Windows.Forms.MenuItem
    Friend WithEvents miConnectionsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miConnectionProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar3 As System.Windows.Forms.MenuItem
    Friend WithEvents miTablesAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar4 As System.Windows.Forms.MenuItem
    Friend WithEvents miTableLayoutView As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar5 As System.Windows.Forms.MenuItem
    Friend WithEvents miTableCommandWizard As System.Windows.Forms.MenuItem
    Friend WithEvents miTableFillSchema As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar6 As System.Windows.Forms.MenuItem
    Friend WithEvents miTableSelectCommand As System.Windows.Forms.MenuItem
    Friend WithEvents miTableInsertCommand As System.Windows.Forms.MenuItem
    Friend WithEvents miTableUpdateCommand As System.Windows.Forms.MenuItem
    Friend WithEvents miTableDeleteCommand As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar7 As System.Windows.Forms.MenuItem
    Friend WithEvents miTableProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar8 As System.Windows.Forms.MenuItem
    Friend WithEvents miCommandProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar9 As System.Windows.Forms.MenuItem
    Friend WithEvents miParametersAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miParameterProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar10 As System.Windows.Forms.MenuItem
    Friend WithEvents miDefaultsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miDefaultProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar11 As System.Windows.Forms.MenuItem
    Friend WithEvents miComputesAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miComputeProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar12 As System.Windows.Forms.MenuItem
    Friend WithEvents miColumnsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miColumnProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar13 As System.Windows.Forms.MenuItem
    Friend WithEvents miUniqueConstraintsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miUniqueConstraintProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar14 As System.Windows.Forms.MenuItem
    Friend WithEvents miForeignKeyConstraintsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miForeignKeyConstraintProperties As System.Windows.Forms.MenuItem
    Friend WithEvents miViewBar15 As System.Windows.Forms.MenuItem
    Friend WithEvents miRelationsAdd As System.Windows.Forms.MenuItem
    Friend WithEvents miRelationProperties As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents miHelp As System.Windows.Forms.MenuItem
    Friend WithEvents miHelpOnTheWeb As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    Friend WithEvents miHelpAbout As System.Windows.Forms.MenuItem
    Friend WithEvents TreeView1 As System.Windows.Forms.TreeView
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Presentation))
        Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.StatusBar1 = New System.Windows.Forms.StatusBar()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog()
        Me.ColorDialog1 = New System.Windows.Forms.ColorDialog()
        Me.FontDialog1 = New System.Windows.Forms.FontDialog()
        Me.tbRedo = New System.Windows.Forms.ToolBarButton()
        Me.tbUndo = New System.Windows.Forms.ToolBarButton()
        Me.tbSep2 = New System.Windows.Forms.ToolBarButton()
        Me.tbPaste = New System.Windows.Forms.ToolBarButton()
        Me.tbCopy = New System.Windows.Forms.ToolBarButton()
        Me.tbCut = New System.Windows.Forms.ToolBarButton()
        Me.tbSep1 = New System.Windows.Forms.ToolBarButton()
        Me.tbSave = New System.Windows.Forms.ToolBarButton()
        Me.tbMain = New System.Windows.Forms.ToolBar()
        Me.imgBlank = New System.Windows.Forms.PictureBox()
        Me.TreeView1 = New System.Windows.Forms.TreeView()
        Me.MainMenu1 = New System.Windows.Forms.MainMenu(Me.components)
        Me.miFile = New System.Windows.Forms.MenuItem()
        Me.miFileImport = New System.Windows.Forms.MenuItem()
        Me.miFileBar1 = New System.Windows.Forms.MenuItem()
        Me.miFileSave = New System.Windows.Forms.MenuItem()
        Me.miFileSaveAs = New System.Windows.Forms.MenuItem()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.miFileClose = New System.Windows.Forms.MenuItem()
        Me.miEdit = New System.Windows.Forms.MenuItem()
        Me.miEditUndo = New System.Windows.Forms.MenuItem()
        Me.miEditRedo = New System.Windows.Forms.MenuItem()
        Me.miEditBar1 = New System.Windows.Forms.MenuItem()
        Me.miEditCut = New System.Windows.Forms.MenuItem()
        Me.miEditCopy = New System.Windows.Forms.MenuItem()
        Me.miEditPaste = New System.Windows.Forms.MenuItem()
        Me.miEditBar2 = New System.Windows.Forms.MenuItem()
        Me.miEditRename = New System.Windows.Forms.MenuItem()
        Me.miView = New System.Windows.Forms.MenuItem()
        Me.miViewOpen = New System.Windows.Forms.MenuItem()
        Me.miViewBar0 = New System.Windows.Forms.MenuItem()
        Me.miPresentationReadRelations = New System.Windows.Forms.MenuItem()
        Me.miViewBar1 = New System.Windows.Forms.MenuItem()
        Me.miPresentationProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar2 = New System.Windows.Forms.MenuItem()
        Me.miConnectionsAdd = New System.Windows.Forms.MenuItem()
        Me.miConnectionProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar3 = New System.Windows.Forms.MenuItem()
        Me.miTablesAdd = New System.Windows.Forms.MenuItem()
        Me.miViewBar4 = New System.Windows.Forms.MenuItem()
        Me.miTableLayoutView = New System.Windows.Forms.MenuItem()
        Me.miViewBar5 = New System.Windows.Forms.MenuItem()
        Me.miTableCommandWizard = New System.Windows.Forms.MenuItem()
        Me.miTableFillSchema = New System.Windows.Forms.MenuItem()
        Me.miViewBar6 = New System.Windows.Forms.MenuItem()
        Me.miTableSelectCommand = New System.Windows.Forms.MenuItem()
        Me.miTableInsertCommand = New System.Windows.Forms.MenuItem()
        Me.miTableUpdateCommand = New System.Windows.Forms.MenuItem()
        Me.miTableDeleteCommand = New System.Windows.Forms.MenuItem()
        Me.miViewBar7 = New System.Windows.Forms.MenuItem()
        Me.miTableProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar8 = New System.Windows.Forms.MenuItem()
        Me.miCommandProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar9 = New System.Windows.Forms.MenuItem()
        Me.miParametersAdd = New System.Windows.Forms.MenuItem()
        Me.miParameterProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar10 = New System.Windows.Forms.MenuItem()
        Me.miDefaultsAdd = New System.Windows.Forms.MenuItem()
        Me.miDefaultProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar11 = New System.Windows.Forms.MenuItem()
        Me.miComputesAdd = New System.Windows.Forms.MenuItem()
        Me.miComputeProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar12 = New System.Windows.Forms.MenuItem()
        Me.miColumnsAdd = New System.Windows.Forms.MenuItem()
        Me.miColumnProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar13 = New System.Windows.Forms.MenuItem()
        Me.miUniqueConstraintsAdd = New System.Windows.Forms.MenuItem()
        Me.miUniqueConstraintProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar14 = New System.Windows.Forms.MenuItem()
        Me.miForeignKeyConstraintsAdd = New System.Windows.Forms.MenuItem()
        Me.miForeignKeyConstraintProperties = New System.Windows.Forms.MenuItem()
        Me.miViewBar15 = New System.Windows.Forms.MenuItem()
        Me.miRelationsAdd = New System.Windows.Forms.MenuItem()
        Me.miRelationProperties = New System.Windows.Forms.MenuItem()
        Me.miHelp = New System.Windows.Forms.MenuItem()
        Me.miHelpOnTheWeb = New System.Windows.Forms.MenuItem()
        Me.MenuItem4 = New System.Windows.Forms.MenuItem()
        Me.miHelpAbout = New System.Windows.Forms.MenuItem()
        CType(Me.imgBlank, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'ContextMenu1
        '
        resources.ApplyResources(Me.ContextMenu1, "ContextMenu1")
        '
        'ImageList1
        '
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        Me.ImageList1.Images.SetKeyName(0, "")
        Me.ImageList1.Images.SetKeyName(1, "")
        Me.ImageList1.Images.SetKeyName(2, "")
        Me.ImageList1.Images.SetKeyName(3, "")
        Me.ImageList1.Images.SetKeyName(4, "")
        Me.ImageList1.Images.SetKeyName(5, "")
        Me.ImageList1.Images.SetKeyName(6, "")
        Me.ImageList1.Images.SetKeyName(7, "")
        Me.ImageList1.Images.SetKeyName(8, "")
        Me.ImageList1.Images.SetKeyName(9, "")
        Me.ImageList1.Images.SetKeyName(10, "")
        Me.ImageList1.Images.SetKeyName(11, "")
        Me.ImageList1.Images.SetKeyName(12, "")
        Me.ImageList1.Images.SetKeyName(13, "")
        Me.ImageList1.Images.SetKeyName(14, "")
        Me.ImageList1.Images.SetKeyName(15, "")
        Me.ImageList1.Images.SetKeyName(16, "")
        Me.ImageList1.Images.SetKeyName(17, "")
        Me.ImageList1.Images.SetKeyName(18, "")
        Me.ImageList1.Images.SetKeyName(19, "")
        Me.ImageList1.Images.SetKeyName(20, "")
        Me.ImageList1.Images.SetKeyName(21, "")
        Me.ImageList1.Images.SetKeyName(22, "")
        Me.ImageList1.Images.SetKeyName(23, "")
        Me.ImageList1.Images.SetKeyName(24, "")
        '
        'StatusBar1
        '
        resources.ApplyResources(Me.StatusBar1, "StatusBar1")
        Me.StatusBar1.Name = "StatusBar1"
        '
        'OpenFileDialog1
        '
        resources.ApplyResources(Me.OpenFileDialog1, "OpenFileDialog1")
        '
        'SaveFileDialog1
        '
        resources.ApplyResources(Me.SaveFileDialog1, "SaveFileDialog1")
        Me.SaveFileDialog1.ShowHelp = True
        '
        'ColorDialog1
        '
        Me.ColorDialog1.AnyColor = True
        Me.ColorDialog1.FullOpen = True
        Me.ColorDialog1.ShowHelp = True
        '
        'FontDialog1
        '
        Me.FontDialog1.ShowHelp = True
        '
        'tbRedo
        '
        resources.ApplyResources(Me.tbRedo, "tbRedo")
        Me.tbRedo.Name = "tbRedo"
        Me.tbRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton
        '
        'tbUndo
        '
        resources.ApplyResources(Me.tbUndo, "tbUndo")
        Me.tbUndo.Name = "tbUndo"
        Me.tbUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton
        '
        'tbSep2
        '
        resources.ApplyResources(Me.tbSep2, "tbSep2")
        Me.tbSep2.Name = "tbSep2"
        Me.tbSep2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
        '
        'tbPaste
        '
        resources.ApplyResources(Me.tbPaste, "tbPaste")
        Me.tbPaste.Name = "tbPaste"
        '
        'tbCopy
        '
        resources.ApplyResources(Me.tbCopy, "tbCopy")
        Me.tbCopy.Name = "tbCopy"
        '
        'tbCut
        '
        resources.ApplyResources(Me.tbCut, "tbCut")
        Me.tbCut.Name = "tbCut"
        '
        'tbSep1
        '
        resources.ApplyResources(Me.tbSep1, "tbSep1")
        Me.tbSep1.Name = "tbSep1"
        Me.tbSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
        '
        'tbSave
        '
        resources.ApplyResources(Me.tbSave, "tbSave")
        Me.tbSave.Name = "tbSave"
        '
        'tbMain
        '
        resources.ApplyResources(Me.tbMain, "tbMain")
        Me.tbMain.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbSave, Me.tbSep1, Me.tbCut, Me.tbCopy, Me.tbPaste, Me.tbSep2, Me.tbUndo, Me.tbRedo})
        Me.tbMain.ImageList = Me.ImageList1
        Me.tbMain.Name = "tbMain"
        '
        'imgBlank
        '
        resources.ApplyResources(Me.imgBlank, "imgBlank")
        Me.imgBlank.Name = "imgBlank"
        Me.imgBlank.TabStop = False
        '
        'TreeView1
        '
        resources.ApplyResources(Me.TreeView1, "TreeView1")
        Me.TreeView1.ContextMenu = Me.ContextMenu1
        Me.TreeView1.HideSelection = False
        Me.TreeView1.ImageList = Me.ImageList1
        Me.TreeView1.ItemHeight = 16
        Me.TreeView1.LabelEdit = True
        Me.TreeView1.Name = "TreeView1"
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.miFile, Me.miEdit, Me.miView, Me.miHelp})
        resources.ApplyResources(Me.MainMenu1, "MainMenu1")
        '
        'miFile
        '
        resources.ApplyResources(Me.miFile, "miFile")
        Me.miFile.Index = 0
        Me.miFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.miFileImport, Me.miFileBar1, Me.miFileSave, Me.miFileSaveAs, Me.MenuItem1, Me.miFileClose})
        Me.miFile.MergeOrder = 1
        Me.miFile.MergeType = System.Windows.Forms.MenuMerge.MergeItems
        '
        'miFileImport
        '
        resources.ApplyResources(Me.miFileImport, "miFileImport")
        Me.miFileImport.Index = 0
        Me.miFileImport.MergeOrder = 6
        '
        'miFileBar1
        '
        resources.ApplyResources(Me.miFileBar1, "miFileBar1")
        Me.miFileBar1.Index = 1
        Me.miFileBar1.MergeOrder = 3
        '
        'miFileSave
        '
        resources.ApplyResources(Me.miFileSave, "miFileSave")
        Me.miFileSave.Index = 2
        Me.miFileSave.MergeOrder = 4
        '
        'miFileSaveAs
        '
        resources.ApplyResources(Me.miFileSaveAs, "miFileSaveAs")
        Me.miFileSaveAs.Index = 3
        Me.miFileSaveAs.MergeOrder = 5
        '
        'MenuItem1
        '
        resources.ApplyResources(Me.MenuItem1, "MenuItem1")
        Me.MenuItem1.Index = 4
        '
        'miFileClose
        '
        resources.ApplyResources(Me.miFileClose, "miFileClose")
        Me.miFileClose.Index = 5
        Me.miFileClose.MergeOrder = 2
        '
        'miEdit
        '
        resources.ApplyResources(Me.miEdit, "miEdit")
        Me.miEdit.Index = 1
        Me.miEdit.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.miEditUndo, Me.miEditRedo, Me.miEditBar1, Me.miEditCut, Me.miEditCopy, Me.miEditPaste, Me.miEditBar2, Me.miEditRename})
        Me.miEdit.MergeOrder = 2
        Me.miEdit.MergeType = System.Windows.Forms.MenuMerge.MergeItems
        '
        'miEditUndo
        '
        resources.ApplyResources(Me.miEditUndo, "miEditUndo")
        Me.miEditUndo.Index = 0
        '
        'miEditRedo
        '
        resources.ApplyResources(Me.miEditRedo, "miEditRedo")
        Me.miEditRedo.Index = 1
        '
        'miEditBar1
        '
        resources.ApplyResources(Me.miEditBar1, "miEditBar1")
        Me.miEditBar1.Index = 2
        '
        'miEditCut
        '
        resources.ApplyResources(Me.miEditCut, "miEditCut")
        Me.miEditCut.Index = 3
        '
        'miEditCopy
        '
        resources.ApplyResources(Me.miEditCopy, "miEditCopy")
        Me.miEditCopy.Index = 4
        '
        'miEditPaste
        '
        resources.ApplyResources(Me.miEditPaste, "miEditPaste")
        Me.miEditPaste.Index = 5
        '
        'miEditBar2
        '
        resources.ApplyResources(Me.miEditBar2, "miEditBar2")
        Me.miEditBar2.Index = 6
        '
        'miEditRename
        '
        resources.ApplyResources(Me.miEditRename, "miEditRename")
        Me.miEditRename.Index = 7
        '
        'miView
        '
        resources.ApplyResources(Me.miView, "miView")
        Me.miView.Index = 2
        Me.miView.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.miViewOpen, Me.miViewBar0, Me.miPresentationReadRelations, Me.miViewBar1, Me.miPresentationProperties, Me.miViewBar2, Me.miConnectionsAdd, Me.miConnectionProperties, Me.miViewBar3, Me.miTablesAdd, Me.miViewBar4, Me.miTableLayoutView, Me.miViewBar5, Me.miTableCommandWizard, Me.miTableFillSchema, Me.miViewBar6, Me.miTableSelectCommand, Me.miTableInsertCommand, Me.miTableUpdateCommand, Me.miTableDeleteCommand, Me.miViewBar7, Me.miTableProperties, Me.miViewBar8, Me.miCommandProperties, Me.miViewBar9, Me.miParametersAdd, Me.miParameterProperties, Me.miViewBar10, Me.miDefaultsAdd, Me.miDefaultProperties, Me.miViewBar11, Me.miComputesAdd, Me.miComputeProperties, Me.miViewBar12, Me.miColumnsAdd, Me.miColumnProperties, Me.miViewBar13, Me.miUniqueConstraintsAdd, Me.miUniqueConstraintProperties, Me.miViewBar14, Me.miForeignKeyConstraintsAdd, Me.miForeignKeyConstraintProperties, Me.miViewBar15, Me.miRelationsAdd, Me.miRelationProperties})
        Me.miView.MergeOrder = 3
        Me.miView.MergeType = System.Windows.Forms.MenuMerge.MergeItems
        '
        'miViewOpen
        '
        resources.ApplyResources(Me.miViewOpen, "miViewOpen")
        Me.miViewOpen.Index = 0
        '
        'miViewBar0
        '
        resources.ApplyResources(Me.miViewBar0, "miViewBar0")
        Me.miViewBar0.Index = 1
        '
        'miPresentationReadRelations
        '
        resources.ApplyResources(Me.miPresentationReadRelations, "miPresentationReadRelations")
        Me.miPresentationReadRelations.Index = 2
        '
        'miViewBar1
        '
        resources.ApplyResources(Me.miViewBar1, "miViewBar1")
        Me.miViewBar1.Index = 3
        '
        'miPresentationProperties
        '
        resources.ApplyResources(Me.miPresentationProperties, "miPresentationProperties")
        Me.miPresentationProperties.Index = 4
        '
        'miViewBar2
        '
        resources.ApplyResources(Me.miViewBar2, "miViewBar2")
        Me.miViewBar2.Index = 5
        '
        'miConnectionsAdd
        '
        resources.ApplyResources(Me.miConnectionsAdd, "miConnectionsAdd")
        Me.miConnectionsAdd.Index = 6
        '
        'miConnectionProperties
        '
        resources.ApplyResources(Me.miConnectionProperties, "miConnectionProperties")
        Me.miConnectionProperties.Index = 7
        '
        'miViewBar3
        '
        resources.ApplyResources(Me.miViewBar3, "miViewBar3")
        Me.miViewBar3.Index = 8
        '
        'miTablesAdd
        '
        resources.ApplyResources(Me.miTablesAdd, "miTablesAdd")
        Me.miTablesAdd.Index = 9
        '
        'miViewBar4
        '
        resources.ApplyResources(Me.miViewBar4, "miViewBar4")
        Me.miViewBar4.Index = 10
        '
        'miTableLayoutView
        '
        resources.ApplyResources(Me.miTableLayoutView, "miTableLayoutView")
        Me.miTableLayoutView.Index = 11
        '
        'miViewBar5
        '
        resources.ApplyResources(Me.miViewBar5, "miViewBar5")
        Me.miViewBar5.Index = 12
        '
        'miTableCommandWizard
        '
        resources.ApplyResources(Me.miTableCommandWizard, "miTableCommandWizard")
        Me.miTableCommandWizard.Index = 13
        '
        'miTableFillSchema
        '
        resources.ApplyResources(Me.miTableFillSchema, "miTableFillSchema")
        Me.miTableFillSchema.Index = 14
        '
        'miViewBar6
        '
        resources.ApplyResources(Me.miViewBar6, "miViewBar6")
        Me.miViewBar6.Index = 15
        '
        'miTableSelectCommand
        '
        resources.ApplyResources(Me.miTableSelectCommand, "miTableSelectCommand")
        Me.miTableSelectCommand.Index = 16
        '
        'miTableInsertCommand
        '
        resources.ApplyResources(Me.miTableInsertCommand, "miTableInsertCommand")
        Me.miTableInsertCommand.Index = 17
        '
        'miTableUpdateCommand
        '
        resources.ApplyResources(Me.miTableUpdateCommand, "miTableUpdateCommand")
        Me.miTableUpdateCommand.Index = 18
        '
        'miTableDeleteCommand
        '
        resources.ApplyResources(Me.miTableDeleteCommand, "miTableDeleteCommand")
        Me.miTableDeleteCommand.Index = 19
        '
        'miViewBar7
        '
        resources.ApplyResources(Me.miViewBar7, "miViewBar7")
        Me.miViewBar7.Index = 20
        '
        'miTableProperties
        '
        resources.ApplyResources(Me.miTableProperties, "miTableProperties")
        Me.miTableProperties.Index = 21
        '
        'miViewBar8
        '
        resources.ApplyResources(Me.miViewBar8, "miViewBar8")
        Me.miViewBar8.Index = 22
        '
        'miCommandProperties
        '
        resources.ApplyResources(Me.miCommandProperties, "miCommandProperties")
        Me.miCommandProperties.Index = 23
        '
        'miViewBar9
        '
        resources.ApplyResources(Me.miViewBar9, "miViewBar9")
        Me.miViewBar9.Index = 24
        '
        'miParametersAdd
        '
        resources.ApplyResources(Me.miParametersAdd, "miParametersAdd")
        Me.miParametersAdd.Index = 25
        '
        'miParameterProperties
        '
        resources.ApplyResources(Me.miParameterProperties, "miParameterProperties")
        Me.miParameterProperties.Index = 26
        '
        'miViewBar10
        '
        resources.ApplyResources(Me.miViewBar10, "miViewBar10")
        Me.miViewBar10.Index = 27
        '
        'miDefaultsAdd
        '
        resources.ApplyResources(Me.miDefaultsAdd, "miDefaultsAdd")
        Me.miDefaultsAdd.Index = 28
        '
        'miDefaultProperties
        '
        resources.ApplyResources(Me.miDefaultProperties, "miDefaultProperties")
        Me.miDefaultProperties.Index = 29
        '
        'miViewBar11
        '
        resources.ApplyResources(Me.miViewBar11, "miViewBar11")
        Me.miViewBar11.Index = 30
        '
        'miComputesAdd
        '
        resources.ApplyResources(Me.miComputesAdd, "miComputesAdd")
        Me.miComputesAdd.Index = 31
        '
        'miComputeProperties
        '
        resources.ApplyResources(Me.miComputeProperties, "miComputeProperties")
        Me.miComputeProperties.Index = 32
        '
        'miViewBar12
        '
        resources.ApplyResources(Me.miViewBar12, "miViewBar12")
        Me.miViewBar12.Index = 33
        '
        'miColumnsAdd
        '
        resources.ApplyResources(Me.miColumnsAdd, "miColumnsAdd")
        Me.miColumnsAdd.Index = 34
        '
        'miColumnProperties
        '
        resources.ApplyResources(Me.miColumnProperties, "miColumnProperties")
        Me.miColumnProperties.Index = 35
        '
        'miViewBar13
        '
        resources.ApplyResources(Me.miViewBar13, "miViewBar13")
        Me.miViewBar13.Index = 36
        '
        'miUniqueConstraintsAdd
        '
        resources.ApplyResources(Me.miUniqueConstraintsAdd, "miUniqueConstraintsAdd")
        Me.miUniqueConstraintsAdd.Index = 37
        '
        'miUniqueConstraintProperties
        '
        resources.ApplyResources(Me.miUniqueConstraintProperties, "miUniqueConstraintProperties")
        Me.miUniqueConstraintProperties.Index = 38
        '
        'miViewBar14
        '
        resources.ApplyResources(Me.miViewBar14, "miViewBar14")
        Me.miViewBar14.Index = 39
        '
        'miForeignKeyConstraintsAdd
        '
        resources.ApplyResources(Me.miForeignKeyConstraintsAdd, "miForeignKeyConstraintsAdd")
        Me.miForeignKeyConstraintsAdd.Index = 40
        '
        'miForeignKeyConstraintProperties
        '
        resources.ApplyResources(Me.miForeignKeyConstraintProperties, "miForeignKeyConstraintProperties")
        Me.miForeignKeyConstraintProperties.Index = 41
        '
        'miViewBar15
        '
        resources.ApplyResources(Me.miViewBar15, "miViewBar15")
        Me.miViewBar15.Index = 42
        '
        'miRelationsAdd
        '
        resources.ApplyResources(Me.miRelationsAdd, "miRelationsAdd")
        Me.miRelationsAdd.Index = 43
        '
        'miRelationProperties
        '
        resources.ApplyResources(Me.miRelationProperties, "miRelationProperties")
        Me.miRelationProperties.Index = 44
        '
        'miHelp
        '
        resources.ApplyResources(Me.miHelp, "miHelp")
        Me.miHelp.Index = 3
        Me.miHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.miHelpOnTheWeb, Me.MenuItem4, Me.miHelpAbout})
        '
        'miHelpOnTheWeb
        '
        resources.ApplyResources(Me.miHelpOnTheWeb, "miHelpOnTheWeb")
        Me.miHelpOnTheWeb.Index = 0
        '
        'MenuItem4
        '
        resources.ApplyResources(Me.MenuItem4, "MenuItem4")
        Me.MenuItem4.Index = 1
        '
        'miHelpAbout
        '
        resources.ApplyResources(Me.miHelpAbout, "miHelpAbout")
        Me.miHelpAbout.Index = 2
        '
        'Presentation
        '
        resources.ApplyResources(Me, "$this")
        Me.Controls.Add(Me.imgBlank)
        Me.Controls.Add(Me.TreeView1)
        Me.Controls.Add(Me.StatusBar1)
        Me.Controls.Add(Me.tbMain)
        Me.KeyPreview = True
        Me.Menu = Me.MainMenu1
        Me.Name = "Presentation"
        CType(Me.imgBlank, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Private selNode As TreeNode

    Private mChanged As Boolean
    Private mConnections As Model10.ConnectionCollection
    Private mEditMode As Avand.EditMode
    Private mLayouts As ArrayList
    Private mOleDbConnection As OleDb.OleDbConnection
    Private mPresentation As Model10.Presentation
    Private mUser As Model10.User
    Private mView As Form

    <Serializable()> Private Structure MyColumn
        Public AllowDBNull As Boolean
        Public AutoIncrement As Boolean
        Public AutoIncrementSeed As Long
        Public AutoIncrementStep As Long
        Public Caption As String
        Public ColumnMapping As Data.MappingType
        Public ColumnName As String
        Public DataType As System.Type
        Public DefaultValue As Object
        Public Expression As String
        Public MaxLength As Integer
        Public Namespace_ As String
        Public Prefix As String
        Public ReadOnly_ As Boolean
        Public Site As System.ComponentModel.ISite
        Public Unique As Boolean
    End Structure

    Private Sub ContextMenu1_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContextMenu1.Popup
        If Not selNode Is Nothing Then TreeView1.SelectedNode = selNode

        ContextMenu1.MenuItems.Clear()
        ContextMenu1.MenuItems(ContextMenu1.MenuItems.Add(miEditCut.CloneMenu)).Shortcut = Shortcut.None
        ContextMenu1.MenuItems(ContextMenu1.MenuItems.Add(miEditCopy.CloneMenu)).Shortcut = Shortcut.None
        ContextMenu1.MenuItems(ContextMenu1.MenuItems.Add(miEditPaste.CloneMenu)).Shortcut = Shortcut.None
        ContextMenu1.MenuItems.Add(miEditBar1.CloneMenu)
        ContextMenu1.MenuItems.Add(miEditRename.CloneMenu)
        ContextMenu1.MenuItems.Add(miEditBar2.CloneMenu)
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 0 'Presentation
                ContextMenu1.MenuItems.Add(miPresentationReadRelations.CloneMenu)
                ContextMenu1.MenuItems.Add("-")
                ContextMenu1.MenuItems.Add(miPresentationProperties.CloneMenu)
            Case 1 'Connections
                ContextMenu1.MenuItems.Add(miConnectionsAdd.CloneMenu)
            Case 2 'Connection
                ContextMenu1.MenuItems.Add(miConnectionProperties.CloneMenu)
            Case 3 'Tables
                ContextMenu1.MenuItems.Add(miTablesAdd.CloneMenu)
            Case 4 'Table
                ContextMenu1.MenuItems.Add(miTableLayoutView.CloneMenu)
                ContextMenu1.MenuItems.Add("-")
                ContextMenu1.MenuItems.Add(miTableCommandWizard.CloneMenu)
                ContextMenu1.MenuItems.Add(miTableFillSchema.CloneMenu)
                ContextMenu1.MenuItems.Add("-")
                ContextMenu1.MenuItems.Add(miTableSelectCommand.CloneMenu)
                ContextMenu1.MenuItems.Add(miTableInsertCommand.CloneMenu)
                ContextMenu1.MenuItems.Add(miTableUpdateCommand.CloneMenu)
                ContextMenu1.MenuItems.Add(miTableDeleteCommand.CloneMenu)
                ContextMenu1.MenuItems.Add("-")
                ContextMenu1.MenuItems.Add(miTableProperties.CloneMenu)
            Case 5 'Command
                ContextMenu1.MenuItems.Add(miCommandProperties.CloneMenu)
            Case 6 'Parameters
                ContextMenu1.MenuItems.Add(miParametersAdd.CloneMenu)
            Case 7 'Parameter
                ContextMenu1.MenuItems.Add(miParameterProperties.CloneMenu)
            Case 8 'Defaults
                ContextMenu1.MenuItems.Add(miDefaultsAdd.CloneMenu)
            Case 9 'Default
                ContextMenu1.MenuItems.Add(miDefaultProperties.CloneMenu)
            Case 10 'Computes
                ContextMenu1.MenuItems.Add(miComputesAdd.CloneMenu)
            Case 11 'Compute
                ContextMenu1.MenuItems.Add(miComputeProperties.CloneMenu)
            Case 12 'Columns
                ContextMenu1.MenuItems.Add(miColumnsAdd.CloneMenu)
            Case 13 'Column
                ContextMenu1.MenuItems.Add(miColumnProperties.CloneMenu)
            Case 14 'Constraints
                ContextMenu1.MenuItems.Add(miUniqueConstraintsAdd.CloneMenu)
                ContextMenu1.MenuItems.Add(miForeignKeyConstraintsAdd.CloneMenu)
            Case 15 'Unique Constraints
                ContextMenu1.MenuItems.Add(miUniqueConstraintProperties.CloneMenu)
            Case 16 'Foreign Key Constraints
                ContextMenu1.MenuItems.Add(miForeignKeyConstraintProperties.CloneMenu)
            Case 17 'Relations
                ContextMenu1.MenuItems.Add(miRelationsAdd.CloneMenu)
            Case 18 'Relation
                ContextMenu1.MenuItems.Add(miRelationProperties.CloneMenu)
        End Select
    End Sub

    Private Sub miFileClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miFileClose.Click
        Me.Close()
    End Sub
    Private Sub miFileSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miFileSave.Click
        If NO_SAVE Then
            MsgBox("This is demo version." & vbCrLf & "Please contact 09121936331 Behrayan Software Ltd.")
        Else
            Try
                Dim obj As Object = Model10.Database.Clone(mPresentation)
                obj = Nothing


                Select Case mEditMode
                    Case [Global].EditMode.[New]
                        miFileSaveAs.PerformClick()
                    Case [Global].EditMode.File
                        If mPresentation.Path = "" Then
                            fMain.SaveFileDialog1.Filter = "Presentation files(*.prs)|*.prs"
                            'fMain.SaveFileDialog1.FileName = ""
                            If fMain.SaveFileDialog1.ShowDialog(Me) = DialogResult.OK Then
                                '----------------------------------
                                mPresentation.Id = 0
                                mPresentation.Name = IO.Path.GetFileName(fMain.SaveFileDialog1.FileName)
                                mPresentation.Path = fMain.SaveFileDialog1.FileName
                                mEditMode = [Global].EditMode.File

                                Me.StatusBar1.Text = mPresentation.Path
                                Me.Text = GetSystemResource("Presentation.Title") & " - " & mPresentation.Name
                                '----------------------------------
                            Else
                                Exit Sub
                            End If
                        End If
                        Application.DoEvents()
                        Cursor.Current = Cursors.WaitCursor
                        '----------------------------------
                        Try
                            Model10.Database.BinFileSerialize(mPresentation.Path, mPresentation)
                            Changed = False
                        Catch ex As Exception
                            MsgBox(ex.Message)
                        End Try
                        '----------------------------------
                        Cursor.Current = Cursors.Default
                    Case [Global].EditMode.Node
                        Application.DoEvents()
                        Cursor.Current = Cursors.WaitCursor
                        '----------------------------------
                        Try
                            mOleDbConnection.Open()
                            Model10.Database.BinNodeSerialize(mPresentation.Id, mPresentation, mOleDbConnection, Nothing)
                            mOleDbConnection.Close()
                            Changed = False
                        Catch ex As Exception
                            mOleDbConnection.Close()
                            MsgBox(ex.Message)
                        End Try
                        '----------------------------------
                        Cursor.Current = Cursors.Default
                End Select


            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
    End Sub
    Private Sub miFileSaveAs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miFileSaveAs.Click
        If NO_SAVE Then
            MsgBox("This is demo version." & vbCrLf & "Please contact 09121936331 Behrayan Software Ltd.")
        Else
            fMain.SaveFileDialog1.FileName = ""
            fMain.SaveFileDialog1.Filter = "Presentation files(*.prs)|*.prs"
            If fMain.SaveFileDialog1.ShowDialog(Me) = DialogResult.OK Then
                Application.DoEvents()
                Cursor.Current = Cursors.WaitCursor
                '----------------------------------
                Try
                    Model10.Database.BinFileSerialize(fMain.SaveFileDialog1.FileName, mPresentation)
                    '----------------------------------
                    mPresentation.Id = 0
                    mPresentation.Name = IO.Path.GetFileName(fMain.SaveFileDialog1.FileName)
                    mPresentation.Path = fMain.SaveFileDialog1.FileName
                    mEditMode = [Global].EditMode.File

                    Me.StatusBar1.Text = mPresentation.Path
                    Me.Text = GetSystemResource("Presentation.Title") & " - " & mPresentation.Name
                    '----------------------------------
                    Changed = False
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
                '----------------------------------
                Cursor.Current = Cursors.Default
            End If
        End If
    End Sub
    Private Sub miFileImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miFileImport.Click
        fMain.OpenFileDialog1.Filter = "Presentation files(*.prs)|*.prs"
        'fMain.OpenFileDialog1.FileName = ""
        If fMain.OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
            Application.DoEvents()
            Cursor.Current = Cursors.WaitCursor
            '----------------------------------
            Try
                Dim prs As Model10.Presentation = CType(Model10.Database.BinFileDeserialize(fMain.OpenFileDialog1.FileName), Model10.Presentation)
                '----------------------------------
                mPresentation.Id = 0
                mPresentation.Name = IO.Path.GetFileName(fMain.OpenFileDialog1.FileName)
                mPresentation.Path = fMain.OpenFileDialog1.FileName
                mEditMode = [Global].EditMode.File

                Me.StatusBar1.Text = mPresentation.Path
                Me.Text = GetSystemResource("Presentation.Title") & " - " & mPresentation.Name
                '----------------------------------
                prs.Id = mPresentation.Id
                prs.Name = mPresentation.Name
                prs.Path = mPresentation.Path

                mPresentation = prs
                prs = Nothing
                Fill()
                Changed = False
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            '----------------------------------
            Cursor.Current = Cursors.Default
        End If
    End Sub

    Private Sub miEditUndo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditUndo.Click
        Changed = True
    End Sub
    Private Sub miEditRedo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditRedo.Click
        Changed = True
    End Sub
    Private Sub miEditCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditCut.Click
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 0, 1, 3, 6, 8, 10, 12, 14, 17
                Exit Sub
            Case 2, 4, 5, 7, 9, 11, 13, 15, 16, 18
                '!!!
        End Select

        If MsgBox("'" & TreeView1.SelectedNode.Text & "' of type '" & TypeName(TreeView1.SelectedNode.Tag) & "' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton1) = MsgBoxResult.Ok Then
            Try
                miEditCopy.PerformClick()
                Select Case TreeView1.SelectedNode.ImageIndex
                    Case 2 'Connection
                        CType(TreeView1.SelectedNode.Parent.Tag, Model10.ConnectionCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Connection))
                    Case 4 'Table
                        CType(TreeView1.SelectedNode.Parent.Tag, Model10.TableCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Table))

                        Dim i As Integer
                        For i = mLayouts.Count - 1 To 0 Step -1
                            Dim frm As Form = CType(mLayouts(i), Form)
                            If TypeOf frm Is Avand.Layout Then
                                Dim f As Avand.Layout = CType(frm, Avand.Layout)
                                If f.Designer1.Table Is TreeView1.SelectedNode.Tag Then
                                    f.Close()
                                    Exit For
                                End If
                                f = Nothing
                            End If
                            frm = Nothing
                        Next
                    Case 5 'Command
                        Select Case CType(TreeView1.SelectedNode.Tag, Model10.Command).GetName
                            Case "Select" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).SelectCommand = Nothing
                            Case "Insert" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).InsertCommand = Nothing
                            Case "Update" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).UpdateCommand = Nothing
                            Case "Delete" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).DeleteCommand = Nothing
                        End Select
                    Case 7 'Parameter
                        CType(TreeView1.SelectedNode.Parent.Tag, Model10.ParameterCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Parameter))
                    Case 9 'Default
                        'CType(TreeView1.SelectedNode.Parent.Tag, Model10.DefaultCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Default))
                    Case 11 'Compute
                        CType(TreeView1.SelectedNode.Parent.Tag, Model10.ComputeCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Compute))
                    Case 13 'Column
                        CType(TreeView1.SelectedNode.Parent.Tag, DataColumnCollection).Remove(CType(TreeView1.SelectedNode.Tag, DataColumn))
                    Case 15, 16 'Constraint
                        CType(TreeView1.SelectedNode.Parent.Tag, ConstraintCollection).Remove(CType(TreeView1.SelectedNode.Tag, Constraint))
                    Case 18 'Relation
                        CType(TreeView1.SelectedNode.Parent.Tag, Model10.RelationCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Relation))
                End Select
                TreeView1.SelectedNode.Remove()
                Changed = True
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
    End Sub
    Private Sub miEditCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditCopy.Click
        Try
            Select Case TreeView1.SelectedNode.ImageIndex
                Case 2 'Connection
                    Clipboard.SetDataObject(New DataObject(New Model10.Connection(CType(TreeView1.SelectedNode.Tag, Model10.Connection))))
                Case 4 'Table
                    Clipboard.SetDataObject(New DataObject(New Model10.Table(CType(TreeView1.SelectedNode.Tag, Model10.Table))))
                Case 7 'Parameter
                    Clipboard.SetDataObject(New DataObject(New Model10.Parameter(CType(TreeView1.SelectedNode.Tag, Model10.Parameter))))
                Case 11 'Compute
                    Clipboard.SetDataObject(New DataObject(New Model10.Compute(CType(TreeView1.SelectedNode.Tag, Model10.Compute))))
                Case 13 'Column
                    Dim col As DataColumn = CType(TreeView1.SelectedNode.Tag, DataColumn)
                    Dim newCol As New MyColumn
                    newCol.AllowDBNull = col.AllowDBNull
                    newCol.AutoIncrement = col.AutoIncrement
                    newCol.AutoIncrementSeed = col.AutoIncrementSeed
                    newCol.AutoIncrementStep = col.AutoIncrementStep
                    newCol.Caption = col.Caption
                    newCol.ColumnMapping = col.ColumnMapping
                    newCol.ColumnName = col.ColumnName
                    newCol.DataType = col.DataType
                    newCol.DefaultValue = col.DefaultValue
                    newCol.Expression = col.Expression
                    newCol.MaxLength = col.MaxLength
                    newCol.Namespace_ = col.Namespace
                    newCol.Prefix = col.Prefix
                    newCol.ReadOnly_ = col.ReadOnly
                    newCol.Site = col.Site
                    newCol.Unique = col.Unique
                    Clipboard.SetDataObject(New DataObject(newCol))
                    newCol = Nothing
                    col = Nothing
            End Select
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
    Private Sub miEditPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditPaste.Click
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 1 'Connections
                If Clipboard.GetDataObject.GetDataPresent(GetType(Model10.Connection)) Then
                    Dim cnn As Model10.Connection = CType(Clipboard.GetDataObject.GetData(GetType(Model10.Connection)), Model10.Connection)
                    Dim cnns As Model10.ConnectionCollection = CType(TreeView1.SelectedNode.Tag, Model10.ConnectionCollection)

                    Dim c As Model10.Connection
                    For Each c In cnns
                        If c.Name.Trim.ToLower = cnn.Name.Trim.ToLower Then
                            cnn.Name = CType(TreeView1.SelectedNode.Parent.Tag, Model10.Presentation).GetNewConnectionName([Global].GetSystemResource("Element.Connection"))
                            Exit For
                        End If
                    Next : c = Nothing

                    cnns.Add(cnn)
                    cnns = Nothing
                    '----------------
                    Dim tn As TreeNode
                    tn = TreeView1.SelectedNode.Nodes.Add(cnn.Name)
                    tn.ImageIndex = 2 : tn.SelectedImageIndex = 2
                    tn.Tag = cnn
                    TreeView1.SelectedNode = tn
                    tn = Nothing
                    '----------------
                    cnn = Nothing
                    Changed = True
                End If
            Case 3 'Tables
                If Clipboard.GetDataObject.GetDataPresent(GetType(Model10.Table)) Then
                    Dim tbl As Model10.Table = CType(Clipboard.GetDataObject.GetData(GetType(Model10.Table)), Model10.Table)
                    Dim tbls As Model10.TableCollection = CType(TreeView1.SelectedNode.Tag, Model10.TableCollection)

                    Dim t As Model10.Table
                    For Each t In tbls
                        If t.Name.Trim.ToLower = tbl.Name.Trim.ToLower Then
                            tbl.Name = CType(TreeView1.SelectedNode.Parent.Tag, Model10.Presentation).GetNewTableName([Global].GetSystemResource("Element.Table"))
                            Exit For
                        End If
                    Next : t = Nothing

                    tbls.Add(tbl)
                    tbls = Nothing
                    '----------------
                    Dim tn As TreeNode
                    tn = TreeView1.SelectedNode.Nodes.Add(tbl.Name)
                    tn.ImageIndex = 4 : tn.SelectedImageIndex = 4
                    tn.Tag = tbl
                    BranchTable(tn, tbl)
                    TreeView1.SelectedNode = tn
                    tn = Nothing
                    '----------------
                    tbl = Nothing
                    Changed = True
                End If
            Case 6 'Parameters
                If Clipboard.GetDataObject.GetDataPresent(GetType(Model10.Parameter)) Then
                    Dim prm As Model10.Parameter = CType(Clipboard.GetDataObject.GetData(GetType(Model10.Parameter)), Model10.Parameter)
                    Dim prms As Model10.ParameterCollection = CType(TreeView1.SelectedNode.Tag, Model10.ParameterCollection)

                    Dim p As Model10.Parameter
                    For Each p In prms
                        If p.Name.Trim.ToLower = prm.Name.Trim.ToLower Then
                            prm.Name = CType(TreeView1.SelectedNode.Parent.Tag, Model10.Command).GetNewParameterName([Global].GetSystemResource("Element.Parameter"))
                            Exit For
                        End If
                    Next : p = Nothing

                    prms.Add(prm)
                    prms = Nothing
                    '----------------
                    Dim tn As TreeNode
                    tn = TreeView1.SelectedNode.Nodes.Add(prm.Name)
                    tn.ImageIndex = 7 : tn.SelectedImageIndex = 7
                    tn.Tag = prm
                    TreeView1.SelectedNode = tn
                    tn = Nothing
                    '----------------
                    prm = Nothing
                    Changed = True
                End If
            Case 10 'Computes
                If Clipboard.GetDataObject.GetDataPresent(GetType(Model10.Compute)) Then
                    Dim cmp As Model10.Compute = CType(Clipboard.GetDataObject.GetData(GetType(Model10.Compute)), Model10.Compute)
                    Dim cmps As Model10.ComputeCollection = CType(TreeView1.SelectedNode.Tag, Model10.ComputeCollection)

                    Dim c As Model10.Compute
                    For Each c In cmps
                        If c.Name.Trim.ToLower = cmp.Name.Trim.ToLower Then
                            cmp.Name = CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).GetNewComputeName([Global].GetSystemResource("Element.Compute"))
                            Exit For
                        End If
                    Next : c = Nothing

                    cmps.Add(cmp)
                    cmps = Nothing
                    '----------------
                    Dim tn As TreeNode
                    tn = TreeView1.SelectedNode.Nodes.Add(cmp.Name)
                    tn.ImageIndex = 11 : tn.SelectedImageIndex = 11
                    tn.Tag = cmp
                    BranchCommand(tn, cmp)
                    TreeView1.SelectedNode = tn
                    tn = Nothing
                    '----------------
                    cmp = Nothing
                    Changed = True
                End If
            Case 12 'Columns
                If Clipboard.GetDataObject.GetDataPresent(GetType(MyColumn)) Then
                    Dim myCol As MyColumn = CType(Clipboard.GetDataObject.GetData(GetType(MyColumn)), MyColumn)
                    Dim col As New DataColumn
                    '-------------------------
                    col.ColumnName = myCol.ColumnName
                    col.DataType = myCol.DataType
                    col.Expression = myCol.Expression
                    col.ColumnMapping = myCol.ColumnMapping

                    col.AllowDBNull = myCol.AllowDBNull
                    col.AutoIncrement = myCol.AutoIncrement
                    col.AutoIncrementSeed = myCol.AutoIncrementSeed
                    col.AutoIncrementStep = myCol.AutoIncrementStep
                    col.Caption = myCol.Caption
                    col.MaxLength = myCol.MaxLength
                    col.Namespace = myCol.Namespace_
                    col.Prefix = myCol.Prefix
                    col.ReadOnly = myCol.ReadOnly_
                    col.Site = myCol.Site
                    col.Unique = myCol.Unique

                    col.DefaultValue = myCol.DefaultValue
                    '-------------------------
                    Dim cols As DataColumnCollection = CType(TreeView1.SelectedNode.Tag, DataColumnCollection)

                    Dim c As DataColumn
                    For Each c In cols
                        If c.ColumnName.Trim.ToLower = col.ColumnName.Trim.ToLower Then
                            col.ColumnName = CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).GetNewColumnName([Global].GetSystemResource("Element.Column"))
                            Exit For
                        End If
                    Next : c = Nothing

                    Try
                        cols.Add(col)
                        '----------------
                        Dim tn As TreeNode
                        tn = TreeView1.SelectedNode.Nodes.Add(col.ColumnName)
                        tn.ImageIndex = 13 : tn.SelectedImageIndex = 13
                        tn.Tag = col
                        'BranchColumn(tn, col)
                        TreeView1.SelectedNode = tn
                        tn = Nothing
                        '----------------
                        Changed = True
                    Catch ex As Exception
                        MsgBox(ex.Message)
                    End Try

                    cols = Nothing
                    col = Nothing
                End If
        End Select
    End Sub
    Private Sub miEditRename_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEditRename.Click
        If TreeView1.SelectedNode.IsEditing Then
            TreeView1.SelectedNode.EndEdit(False)
        Else
            TreeView1.SelectedNode.BeginEdit()
        End If
    End Sub

    Private Sub miViewOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miViewOpen.Click
        Try
            Dim prs As Model10.Presentation = CType(Model10.Database.Clone(mPresentation), Model10.Presentation)
            prs.Id = mPresentation.Id
            prs.Name = mPresentation.Name
            prs.Path = mPresentation.Path
            [Global].OpenPresentation(prs, mUser, Me, mOleDbConnection, mConnections)
            prs = Nothing
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
    Private Sub miPresentationReadRelations_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miPresentationReadRelations.Click
        Application.DoEvents()
        Cursor.Current = Cursors.WaitCursor
        '----------------------------------
        Try
            mPresentation.OpenConnections()

            Dim tbl As Model10.Table
            For Each tbl In mPresentation.Tables
                Try
                    FillRelation(tbl)
                Catch ex As Exception
                End Try
            Next : tbl = Nothing

            BranchTables(TreeView1.SelectedNode.Nodes(1), mPresentation.Tables)
            BranchRelations(TreeView1.SelectedNode.Nodes(2), mPresentation.Relations)
            Changed = True
            mPresentation.CloseConnections()
        Catch ex As Exception
            mPresentation.CloseConnections()
            MsgBox(ex.Message)
        End Try
        '----------------------------------
        Cursor.Current = Cursors.Default
    End Sub
    Private Sub miPresentationProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miPresentationProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FPresentation(CType(TreeView1.SelectedNode.Tag, Model10.Presentation))
            frm.ShowDialog(Me)
            If frm.Changed Then Changed = True
            frm = Nothing
        End If
    End Sub
    Private Sub miConnectionsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miConnectionsAdd.Click
        Dim frm As New Avand.FConnection(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Presentation), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Connection.Name)
            tn.ImageIndex = 2 : tn.SelectedImageIndex = 2
            tn.Tag = frm.Connection
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miConnectionProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miConnectionProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FConnection(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Presentation), CType(TreeView1.SelectedNode.Tag, Model10.Connection))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Connection).Name
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miTableLayoutView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableLayoutView.Click
        Dim foo As Form

        Dim frm As Form
        For Each frm In mLayouts
            If TypeOf frm Is Avand.Layout Then
                If CType(frm, Avand.Layout).Designer1.Table Is TreeView1.SelectedNode.Tag Then
                    foo = frm
                    Exit For
                End If
            End If
        Next : frm = Nothing

        If foo Is Nothing Then
            Dim lay As New Avand.Layout(Me, CType(TreeView1.SelectedNode.Tag, Model10.Table), mOleDbConnection, mConnections)
            lay.Show()
            lay = Nothing
        Else
            foo.Select()
        End If
        foo = Nothing
    End Sub
    Private Sub miTableCommandWizard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableCommandWizard.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)

        Dim frm As New Avand.Command(tbl)
        If frm.ShowDialog(Me) = DialogResult.OK Then
            Application.DoEvents()
            Cursor.Current = Cursors.WaitCursor
            '----------------------------------
            If frm.chkFillColumns.Checked Then
                Try
                    mPresentation.OpenConnections()
                    If Not tbl.SelectCommand Is Nothing Then
                        Dim da As New OleDb.OleDbDataAdapter(tbl.SelectCommand.OleDbCommand)
                        Try
                            da.FillSchema(tbl.DataTable, SchemaType.Mapped)
                        Catch ex As Exception
                        End Try
                        da = Nothing
                    End If
                    If frm.chkFillRelations.Checked Then
                        Try
                            FillRelation(tbl)
                        Catch ex As Exception
                        End Try
                        BranchRelations(TreeView1.SelectedNode.Parent.Parent.Nodes(2), mPresentation.Relations)
                        Changed = True
                    End If
                    BranchTables(TreeView1.SelectedNode.Parent.Parent.Nodes(1), mPresentation.Tables)
                    If tbl.DataTable.PrimaryKey.Length = 1 Then
                        'tbl.RetrieveIdentity = tbl.DataTable.PrimaryKey(0).AutoIncrement
                    End If
                    Changed = True
                    mPresentation.CloseConnections()
                Catch ex As Exception
                    mPresentation.CloseConnections()
                    MsgBox(ex.Message)
                End Try
            End If
            '----------------------------------
            Cursor.Current = Cursors.Default
        End If
        frm = Nothing

        tbl = Nothing
    End Sub
    Private Sub miTableFillSchema_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableFillSchema.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)
        If tbl.SelectCommand Is Nothing Then
            MsgBox("There is no select command for " & tbl.Name & ".")
        Else
            Application.DoEvents()
            Cursor.Current = Cursors.WaitCursor
            '----------------------------------
            Try
                Dim da As New OleDb.OleDbDataAdapter(tbl.SelectCommand.OleDbCommand)
                da.FillSchema(tbl.DataTable, SchemaType.Mapped)
                da = Nothing

                BranchTable(TreeView1.SelectedNode, tbl)
                Changed = True
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            '----------------------------------
            Cursor.Current = Cursors.Default
        End If
        tbl = Nothing
    End Sub
    Private Sub miTableSelectCommand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableSelectCommand.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)
        If tbl.SelectCommand Is Nothing Then
            Dim frm As New Avand.FCommand("Select", tbl, Nothing)
            frm.ShowDialog(Me)
            If frm.Changed Then
                tbl.SelectCommand = frm.Command
                '---------------------
                Dim tn As New TreeNode(GetSystemResource("Command.Select"))
                Dim i As Integer
                '...
                TreeView1.SelectedNode.Nodes.Insert(i, tn)
                tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
                tn.Tag = tbl.SelectCommand
                BranchCommand(tn, tbl.SelectCommand)
                TreeView1.SelectedNode = tn
                tn = Nothing
                '---------------------
                miTableSelectCommand.Checked = True
                Changed = True
            End If
            frm = Nothing
        Else
            If MsgBox("'Select Command' of type 'Command' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton2) = MsgBoxResult.Ok Then
                Dim cmd As Model10.Command = tbl.SelectCommand
                tbl.SelectCommand = Nothing

                Dim tn As TreeNode
                For Each tn In TreeView1.SelectedNode.Nodes
                    If tn.Tag Is cmd Then
                        tn.Remove()
                        Exit For
                    End If
                Next : tn = Nothing

                cmd = Nothing
                miTableSelectCommand.Checked = False
                TreeView1.SelectedNode.Expand()
                Changed = True
            End If
        End If
        tbl = Nothing
    End Sub
    Private Sub miTableInsertCommand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableInsertCommand.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)
        If tbl.InsertCommand Is Nothing Then
            Dim frm As New Avand.FCommand("Insert", tbl, Nothing)
            frm.ShowDialog(Me)
            If frm.Changed Then
                tbl.InsertCommand = frm.Command
                '---------------------
                Dim tn As New TreeNode(GetSystemResource("Command.Insert"))
                Dim i As Integer
                If Not tbl.SelectCommand Is Nothing Then i += 1
                TreeView1.SelectedNode.Nodes.Insert(i, tn)
                tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
                tn.Tag = tbl.InsertCommand
                BranchCommand(tn, tbl.InsertCommand)
                TreeView1.SelectedNode = tn
                tn = Nothing
                '---------------------
                miTableInsertCommand.Checked = True
                Changed = True
            End If
            frm = Nothing
        Else
            If MsgBox("'Insert Command' of type 'Command' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton2) = MsgBoxResult.Ok Then
                Dim cmd As Model10.Command = tbl.InsertCommand
                tbl.InsertCommand = Nothing

                Dim tn As TreeNode
                For Each tn In TreeView1.SelectedNode.Nodes
                    If tn.Tag Is cmd Then
                        tn.Remove()
                        Exit For
                    End If
                Next : tn = Nothing

                cmd = Nothing
                miTableInsertCommand.Checked = False
                TreeView1.SelectedNode.Expand()
                Changed = True
            End If
        End If
        tbl = Nothing
    End Sub
    Private Sub miTableUpdateCommand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableUpdateCommand.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)
        If tbl.UpdateCommand Is Nothing Then
            Dim frm As New Avand.FCommand("Update", tbl, Nothing)
            frm.ShowDialog(Me)
            If frm.Changed Then
                tbl.UpdateCommand = frm.Command
                '---------------------
                Dim tn As New TreeNode(GetSystemResource("Command.Update"))
                Dim i As Integer
                If Not tbl.SelectCommand Is Nothing Then i += 1
                If Not tbl.InsertCommand Is Nothing Then i += 1
                TreeView1.SelectedNode.Nodes.Insert(i, tn)
                tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
                tn.Tag = tbl.UpdateCommand
                BranchCommand(tn, tbl.UpdateCommand)
                TreeView1.SelectedNode = tn
                tn = Nothing
                '---------------------
                miTableUpdateCommand.Checked = True
                Changed = True
            End If
            frm = Nothing
        Else
            If MsgBox("'Update Command' of type 'Command' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton2) = MsgBoxResult.Ok Then
                Dim cmd As Model10.Command = tbl.UpdateCommand
                tbl.UpdateCommand = Nothing

                Dim tn As TreeNode
                For Each tn In TreeView1.SelectedNode.Nodes
                    If tn.Tag Is cmd Then
                        tn.Remove()
                        Exit For
                    End If
                Next : tn = Nothing

                cmd = Nothing
                miTableUpdateCommand.Checked = False
                TreeView1.SelectedNode.Expand()
                Changed = True
            End If
        End If
        tbl = Nothing
    End Sub
    Private Sub miTableDeleteCommand_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableDeleteCommand.Click
        Dim tbl As Model10.Table = CType(TreeView1.SelectedNode.Tag, Model10.Table)
        If tbl.DeleteCommand Is Nothing Then
            Dim frm As New Avand.FCommand("Delete", tbl, Nothing)
            frm.ShowDialog(Me)
            If frm.Changed Then
                tbl.DeleteCommand = frm.Command
                '---------------------
                Dim tn As New TreeNode(GetSystemResource("Command.Delete"))
                Dim i As Integer
                If Not tbl.SelectCommand Is Nothing Then i += 1
                If Not tbl.InsertCommand Is Nothing Then i += 1
                If Not tbl.UpdateCommand Is Nothing Then i += 1
                TreeView1.SelectedNode.Nodes.Insert(i, tn)
                tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
                tn.Tag = tbl.DeleteCommand
                BranchCommand(tn, tbl.DeleteCommand)
                TreeView1.SelectedNode = tn
                tn = Nothing
                '---------------------
                miTableDeleteCommand.Checked = True
                Changed = True
            End If
            frm = Nothing
        Else
            If MsgBox("'Delete Command' of type 'Command' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton2) = MsgBoxResult.Ok Then
                Dim cmd As Model10.Command = tbl.DeleteCommand
                tbl.DeleteCommand = Nothing

                Dim tn As TreeNode
                For Each tn In TreeView1.SelectedNode.Nodes
                    If tn.Tag Is cmd Then
                        tn.Remove()
                        Exit For
                    End If
                Next : tn = Nothing

                cmd = Nothing
                miTableDeleteCommand.Checked = False
                TreeView1.SelectedNode.Expand()
                Changed = True
            End If
        End If
        tbl = Nothing
    End Sub
    Private Sub miTableProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTableProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FTable(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Presentation), CType(TreeView1.SelectedNode.Tag, Model10.Table))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Table).Name

                Dim lay As Avand.Layout
                For Each lay In mLayouts
                    If lay.Designer1.Table Is TreeView1.SelectedNode.Tag Then
                        lay.Size = lay.Designer1.Table.Size
                        lay.Fill()
                        Exit For
                    End If
                Next : lay = Nothing

                UpdateConstraints(TreeView1.SelectedNode)
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miTablesAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miTablesAdd.Click
        Dim frm As New Avand.FDataTable(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Presentation), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Table.Name)
            tn.ImageIndex = 4 : tn.SelectedImageIndex = 4
            tn.Tag = frm.Table
            BranchTable(tn, frm.Table)
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miCommandProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miCommandProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FCommand(CType(TreeView1.SelectedNode.Tag, Model10.Command).GetName, CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, Model10.Command))
            frm.ShowDialog(Me)
            If frm.Changed Then Changed = True
            frm = Nothing
        End If
    End Sub
    Private Sub miParametersAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miParametersAdd.Click
        Dim frm As New Avand.FParameter(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Command), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Parameter.Name)
            tn.ImageIndex = 7 : tn.SelectedImageIndex = 7
            tn.Tag = frm.Parameter
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miParameterProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miParameterProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FParameter(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Command), CType(TreeView1.SelectedNode.Tag, Model10.Parameter))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Parameter).Name
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miDefaultsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miDefaultsAdd.Click
        'Dim frm As New Avand.FDefault(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), Nothing)
        'frm.ShowDialog(Me)
        'If frm.Changed Then
        '    '---------------------
        '    Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Default.Name)
        '    tn.ImageIndex = 9 : tn.SelectedImageIndex = 9
        '    tn.Tag = frm.Default
        '    'BranchPartner(tn, frm.partner)
        '    TreeView1.SelectedNode = tn
        '    tn = Nothing
        '    '---------------------
        '    Changed = True
        'End If
        'frm = Nothing
    End Sub
    Private Sub miDefaultProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miDefaultProperties.Click
        'If Not TreeView1.SelectedNode.IsEditing Then
        '    Dim frm As New Avand.FDefault(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, Model10.Default))
        '    frm.ShowDialog(Me)
        '    If frm.Changed Then
        '        TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Default).Name
        '        Changed = True
        '    End If
        '    frm = Nothing
        'End If
    End Sub
    Private Sub miComputesAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miComputesAdd.Click
        Dim frm As New Avand.FCompute(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Compute.Name)
            tn.ImageIndex = 11 : tn.SelectedImageIndex = 11
            tn.Tag = frm.Compute
            BranchCommand(tn, frm.Compute)
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miComputeProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miComputeProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FCompute(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, Model10.Compute))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Compute).Name
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miColumnsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miColumnsAdd.Click
        Dim frm As New Avand.FDataColumn(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.DataColumn.ColumnName)
            tn.ImageIndex = 13 : tn.SelectedImageIndex = 13
            tn.Tag = frm.DataColumn
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miColumnProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miColumnProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FDataColumn(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, DataColumn))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, DataColumn).ColumnName
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miUniqueConstraintsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miUniqueConstraintsAdd.Click
        Dim frm As New Avand.FUniqueConstraint(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.UniqueConstraint.ConstraintName)
            tn.ImageIndex = 15 : tn.SelectedImageIndex = 15
            tn.Tag = frm.UniqueConstraint
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miUniqueConstraintProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miUniqueConstraintProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FUniqueConstraint(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, UniqueConstraint))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Constraint).ConstraintName
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miForeignKeyConstraintsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miForeignKeyConstraintsAdd.Click
        Dim frm As New Avand.FForeignKeyConstraint(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.ForeignKeyConstraint.ConstraintName)
            tn.ImageIndex = 16 : tn.SelectedImageIndex = 16
            tn.Tag = frm.ForeignKeyConstraint
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------
            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miForeignKeyConstraintProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miForeignKeyConstraintProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FForeignKeyConstraint(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Table), CType(TreeView1.SelectedNode.Tag, ForeignKeyConstraint))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Constraint).ConstraintName
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub
    Private Sub miRelationsAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miRelationsAdd.Click
        Dim frm As New Avand.FDataRelation(CType(TreeView1.SelectedNode.Parent.Tag, Model10.Presentation), Nothing)
        frm.ShowDialog(Me)
        If frm.Changed Then
            '---------------------
            Dim tn As TreeNode = TreeView1.SelectedNode.Nodes.Add(frm.Relation.Name)
            tn.ImageIndex = 18 : tn.SelectedImageIndex = 18
            tn.Tag = frm.Relation
            TreeView1.SelectedNode = tn
            tn = Nothing
            '---------------------

            Dim n As TreeNode
            For Each n In TreeView1.Nodes(0).Nodes(1).Nodes
                UpdateConstraints(n)
            Next : n = Nothing

            Changed = True
        End If
        frm = Nothing
    End Sub
    Private Sub miRelationProperties_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miRelationProperties.Click
        If Not TreeView1.SelectedNode.IsEditing Then
            Dim frm As New Avand.FRelation(CType(TreeView1.SelectedNode.Parent.Parent.Tag, Model10.Presentation), CType(TreeView1.SelectedNode.Tag, Model10.Relation))
            frm.ShowDialog(Me)
            If frm.Changed Then
                TreeView1.SelectedNode.Text = CType(TreeView1.SelectedNode.Tag, Model10.Relation).Name
                Changed = True
            End If
            frm = Nothing
        End If
    End Sub

    Private Sub miHelpOnTheWeb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miHelpOnTheWeb.Click
        Process.Start("http://www.radplatform.com")
    End Sub
    Private Sub miHelpAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miHelpAbout.Click
        Dim frm As New Avand.About
        frm.ShowDialog(Me)
        frm = Nothing
    End Sub

    Private Sub Presentation_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If mChanged Then
            Select Case MsgBox("Save Changes?", MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Exclamation, "Save Presentation")
                Case MsgBoxResult.Cancel
                    e.Cancel = True
                Case MsgBoxResult.Yes
                    miFileSave.PerformClick()
                    If mChanged Then e.Cancel = True
            End Select
        End If
        If Not e.Cancel Then
            Dim i As Integer
            For i = mLayouts.Count - 1 To 0 Step -1
                CType(mLayouts(i), Form).Close()
            Next

            If Not mView Is Nothing Then If mView.Visible Then mView.Close()
        End If
    End Sub
    Private Sub tbMain_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMain.ButtonClick
        Select Case tbMain.Buttons.IndexOf(e.Button)
            Case 0 : miFileSave.PerformClick()
            Case 1 '-
            Case 2 : miEditCut.PerformClick()
            Case 3 : miEditCopy.PerformClick()
            Case 4 : miEditPaste.PerformClick()
            Case 5 '-
            Case 6 : miEditUndo.PerformClick()
            Case 7 : miEditRedo.PerformClick()
        End Select
    End Sub

    Private Sub TreeView1_AfterLabelEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.NodeLabelEditEventArgs) Handles TreeView1.AfterLabelEdit
        If Not e.Label Is Nothing Then
            Try
                Select Case TreeView1.SelectedNode.ImageIndex
                    Case 2 'Connection
                        CType(TreeView1.SelectedNode.Tag, Model10.Connection).Name = e.Label
                    Case 4 'Table
                        CType(TreeView1.SelectedNode.Tag, Model10.Table).Name = e.Label

                        Dim lay As Avand.Layout
                        For Each lay In mLayouts
                            If lay.Designer1.Table Is TreeView1.SelectedNode.Tag Then
                                lay.Text = GetSystemResource("Layout.Title") & " - " & mPresentation.Name & "\" & e.Label
                                Exit For
                            End If
                        Next : lay = Nothing
                    Case 7 'Parameter
                        CType(TreeView1.SelectedNode.Tag, Model10.Parameter).Name = e.Label
                    Case 11 'Compute
                        CType(TreeView1.SelectedNode.Tag, Model10.Compute).Name = e.Label
                    Case 13 'Column
                        CType(TreeView1.SelectedNode.Tag, DataColumn).ColumnName = e.Label
                    Case 15, 16 'Constraint
                        CType(TreeView1.SelectedNode.Tag, Constraint).ConstraintName = e.Label
                    Case 18 'Relation
                        CType(TreeView1.SelectedNode.Tag, Model10.Relation).Name = e.Label
                End Select
                TreeView1.SelectedNode.Text = e.Label
                Changed = True
            Catch ex As Exception
                e.CancelEdit = True
                MsgBox(ex.Message)
                TreeView1.SelectedNode.BeginEdit()
            End Try
        End If

        If Not TreeView1.SelectedNode.IsEditing Then
            miEditCut.Shortcut = Shortcut.CtrlX
            miEditCopy.Shortcut = Shortcut.CtrlC
            miEditPaste.Shortcut = Shortcut.CtrlV
        End If
    End Sub
    Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 1, 3, 6, 10, 12
                miEditBar1.Visible = True '--------------------
                miEditCut.Visible = False : tbCut.Enabled = False
                miEditCopy.Visible = False : tbCopy.Enabled = False
                miEditPaste.Visible = True : tbPaste.Enabled = True
            Case 2, 4, 7, 11, 13
                miEditBar1.Visible = True '--------------------
                miEditCut.Visible = True : tbCut.Enabled = True
                miEditCopy.Visible = True : tbCopy.Enabled = True
                miEditPaste.Visible = False : tbPaste.Enabled = False
            Case 5, 15, 16, 18
                miEditBar1.Visible = True '--------------------
                miEditCut.Visible = True : tbCut.Enabled = True
                miEditCopy.Visible = False : tbCopy.Enabled = False
                miEditPaste.Visible = False : tbPaste.Enabled = False
            Case Else
                miEditBar1.Visible = False '--------------------
                miEditCut.Visible = False : tbCut.Enabled = False
                miEditCopy.Visible = False : tbCopy.Enabled = False
                miEditPaste.Visible = False : tbPaste.Enabled = False
        End Select
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 0, 1, 3, 5, 6, 8, 10, 12, 14, 17
                miEditBar2.Visible = False '--------------------
                miEditRename.Visible = False
            Case 2, 4, 7, 9, 11, 13, 15, 16, 18
                miEditBar2.Visible = True '--------------------
                miEditRename.Visible = True
        End Select

        miPresentationReadRelations.Visible = False
        miViewBar1.Visible = False '--------------------
        miPresentationProperties.Visible = False : miPresentationProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miConnectionsAdd.Visible = False
        miConnectionProperties.Visible = False : miConnectionProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miTablesAdd.Visible = False
        '-----------------------------------------------
        miTableLayoutView.Visible = False
        miViewBar5.Visible = False '--------------------
        miTableCommandWizard.Visible = False
        miTableFillSchema.Visible = False
        miViewBar6.Visible = False '--------------------
        miTableSelectCommand.Visible = False
        miTableInsertCommand.Visible = False
        miTableUpdateCommand.Visible = False
        miTableDeleteCommand.Visible = False
        miViewBar7.Visible = False '--------------------
        miTableProperties.Visible = False : miTableProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miCommandProperties.Visible = False : miCommandProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miParametersAdd.Visible = False
        miParameterProperties.Visible = False : miParameterProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miDefaultsAdd.Visible = False
        miDefaultProperties.Visible = False : miDefaultProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miComputesAdd.Visible = False
        miComputeProperties.Visible = False : miComputeProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miColumnsAdd.Visible = False
        miColumnProperties.Visible = False : miColumnProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miUniqueConstraintsAdd.Visible = False
        miUniqueConstraintProperties.Visible = False : miUniqueConstraintProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miForeignKeyConstraintsAdd.Visible = False
        miForeignKeyConstraintProperties.Visible = False : miForeignKeyConstraintProperties.Shortcut = Shortcut.None
        '-----------------------------------------------
        miRelationsAdd.Visible = False
        miRelationProperties.Visible = False : miRelationProperties.Shortcut = Shortcut.None

        Select Case TreeView1.SelectedNode.ImageIndex
            Case 0 'Presentation
                miPresentationReadRelations.Visible = True
                miViewBar1.Visible = True '--------------------
                miPresentationProperties.Visible = True : miPresentationProperties.Shortcut = Shortcut.F4
            Case 1 'Connections
                miConnectionsAdd.Visible = True
            Case 2 'Connection
                miConnectionProperties.Visible = True : miConnectionProperties.Shortcut = Shortcut.F4
            Case 3 'Tables
                miTablesAdd.Visible = True
            Case 4 'Table
                miTableLayoutView.Visible = True
                miViewBar5.Visible = True '---------------------
                miTableCommandWizard.Visible = True
                miTableFillSchema.Visible = True
                miViewBar6.Visible = True '---------------------
                miTableSelectCommand.Visible = True
                miTableInsertCommand.Visible = True
                miTableUpdateCommand.Visible = True
                miTableDeleteCommand.Visible = True
                Dim tbl As Model10.Table = CType(e.Node.Tag, Model10.Table)
                miTableSelectCommand.Checked = Not tbl.SelectCommand Is Nothing
                miTableInsertCommand.Checked = Not tbl.InsertCommand Is Nothing
                miTableUpdateCommand.Checked = Not tbl.UpdateCommand Is Nothing
                miTableDeleteCommand.Checked = Not tbl.DeleteCommand Is Nothing
                tbl = Nothing
                miViewBar7.Visible = True '---------------------
                miTableProperties.Visible = True : miTableProperties.Shortcut = Shortcut.F4
            Case 5 'Command
                miCommandProperties.Visible = True : miCommandProperties.Shortcut = Shortcut.F4
            Case 6 'Parameters
                miParametersAdd.Visible = True
            Case 7 'Parameter
                miParameterProperties.Visible = True : miParameterProperties.Shortcut = Shortcut.F4
            Case 8 'Defaults
                miDefaultsAdd.Visible = True
            Case 9 'Default
                miDefaultProperties.Visible = True : miDefaultProperties.Shortcut = Shortcut.F4
            Case 10 'Computes
                miComputesAdd.Visible = True
            Case 11 'Compute
                miComputeProperties.Visible = True : miComputeProperties.Shortcut = Shortcut.F4
            Case 12 'Columns
                miColumnsAdd.Visible = True
            Case 13 'Column
                miColumnProperties.Visible = True : miColumnProperties.Shortcut = Shortcut.F4
            Case 14 'Constraints
                miUniqueConstraintsAdd.Visible = True
                miForeignKeyConstraintsAdd.Visible = True
            Case 15 'Unique Constraint
                miUniqueConstraintProperties.Visible = True : miUniqueConstraintProperties.Shortcut = Shortcut.F4
            Case 16 'Foreign Key Constraints
                miForeignKeyConstraintProperties.Visible = True : miForeignKeyConstraintProperties.Shortcut = Shortcut.F4
            Case 17 'Relations
                miRelationsAdd.Visible = True
            Case 18 'Relation
                miRelationProperties.Visible = True : miRelationProperties.Shortcut = Shortcut.F4
        End Select
    End Sub
    Private Sub TreeView1_BeforeLabelEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.NodeLabelEditEventArgs) Handles TreeView1.BeforeLabelEdit
        Select Case e.Node.ImageIndex
            Case 0, 1, 3, 5, 6, 8, 10, 12, 14, 17 : e.CancelEdit = True
            Case Else
                miEditCut.Shortcut = Shortcut.None
                miEditCopy.Shortcut = Shortcut.None
                miEditPaste.Shortcut = Shortcut.None
        End Select
    End Sub
    Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.DoubleClick
        Select Case TreeView1.SelectedNode.ImageIndex
            Case 2
                miConnectionProperties.PerformClick()
            Case 7
                miParameterProperties.PerformClick()
            Case 13
                miColumnProperties.PerformClick()
            Case 15
                miUniqueConstraintProperties.PerformClick()
            Case 16
                miForeignKeyConstraintProperties.PerformClick()
            Case 18
                miRelationProperties.PerformClick()
        End Select
    End Sub
    Private Sub TreeView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TreeView1.KeyDown
        Select Case e.KeyCode
            Case Keys.Delete
                Select Case TreeView1.SelectedNode.ImageIndex
                    Case 0, 1, 3, 6, 8, 10, 12, 14, 17
                        Exit Sub
                    Case 2, 4, 5, 7, 9, 11, 13, 15, 16, 18
                        '!!!
                End Select

                If MsgBox("'" & TreeView1.SelectedNode.Text & "' of type '" & TypeName(TreeView1.SelectedNode.Tag) & "' will be deleted.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton1) = MsgBoxResult.Ok Then
                    'miEditCopy.PerformClick()
                    Try
                        Select Case TreeView1.SelectedNode.ImageIndex
                            Case 2 'Connection
                                CType(TreeView1.SelectedNode.Parent.Tag, Model10.ConnectionCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Connection))
                            Case 4 'Table
                                CType(TreeView1.SelectedNode.Parent.Tag, Model10.TableCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Table))

                                Dim i As Integer
                                For i = mLayouts.Count - 1 To 0 Step -1
                                    Dim frm As Form = CType(mLayouts(i), Form)
                                    If TypeOf frm Is Avand.Layout Then
                                        Dim f As Avand.Layout = CType(frm, Avand.Layout)
                                        If f.Designer1.Table Is TreeView1.SelectedNode.Tag Then
                                            f.Close()
                                            Exit For
                                        End If
                                        f = Nothing
                                    End If
                                    frm = Nothing
                                Next
                            Case 5 'Command
                                Select Case CType(TreeView1.SelectedNode.Tag, Model10.Command).GetName
                                    Case "Select" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).SelectCommand = Nothing
                                    Case "Insert" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).InsertCommand = Nothing
                                    Case "Update" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).UpdateCommand = Nothing
                                    Case "Delete" : CType(TreeView1.SelectedNode.Parent.Tag, Model10.Table).DeleteCommand = Nothing
                                End Select
                            Case 7 'Parameter
                                CType(TreeView1.SelectedNode.Parent.Tag, Model10.ParameterCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Parameter))
                            Case 9 'Default
                                'CType(TreeView1.SelectedNode.Parent.Tag, Model10.DefaultCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Default))
                            Case 11 'Compute
                                CType(TreeView1.SelectedNode.Parent.Tag, Model10.ComputeCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Compute))
                            Case 13 'Column
                                CType(TreeView1.SelectedNode.Parent.Tag, DataColumnCollection).Remove(CType(TreeView1.SelectedNode.Tag, DataColumn))
                            Case 15, 16 'Constraint
                                CType(TreeView1.SelectedNode.Parent.Tag, ConstraintCollection).Remove(CType(TreeView1.SelectedNode.Tag, Constraint))
                            Case 18 'Relation
                                CType(TreeView1.SelectedNode.Parent.Tag, Model10.RelationCollection).Remove(CType(TreeView1.SelectedNode.Tag, Model10.Relation))
                        End Select
                        TreeView1.SelectedNode.Remove()
                        Changed = True
                    Catch ex As Exception
                        MsgBox(ex.Message)
                    End Try
                End If
            Case Keys.Enter
                If e.KeyCode = Keys.Enter Then
                    Select Case TreeView1.SelectedNode.ImageIndex
                        Case 0 'Presentation
                            miPresentationProperties.PerformClick()
                        Case 1 'Connections
                        Case 2 'Connection
                            miConnectionProperties.PerformClick()
                        Case 3 'Tables
                        Case 4 'Table
                            miTableProperties.PerformClick()
                        Case 5 'Command
                            miCommandProperties.PerformClick()
                        Case 6 'Parameters
                        Case 7 'Parameter
                            miParameterProperties.PerformClick()
                        Case 8 'Defaults
                        Case 9 'Default
                            miDefaultsAdd.PerformClick()
                        Case 10 'Computes
                        Case 11 'Compute
                            miComputeProperties.PerformClick()
                        Case 12 'Columns
                        Case 13 'Column
                            miColumnProperties.PerformClick()
                        Case 14 'Constraints
                        Case 15 'Unique Constraint
                            miUniqueConstraintProperties.PerformClick()
                        Case 16 'Foreign Key Constraints
                            miForeignKeyConstraintProperties.PerformClick()
                        Case 17 'Relations
                        Case 18 'Relation
                            miRelationProperties.PerformClick()
                    End Select
                End If
        End Select
    End Sub
    Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
        Me.Select() : TreeView1.Select()
        If e.Button = MouseButtons.Right Then
            selNode = TreeView1.GetNodeAt(e.X, e.Y)
        Else
            selNode = Nothing
        End If
    End Sub

    Private Sub BranchPresentation(ByVal node As TreeNode, ByVal presentation As Model10.Presentation)
        Dim i As Integer

        Dim connectionsNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            connectionsNode = node.Nodes.Add(GetSystemResource("Collection.Connections"))
        Else
            connectionsNode = node.Nodes(i)
            connectionsNode.Text = GetSystemResource("Collection.Connections")
        End If
        connectionsNode.ImageIndex = 1 : connectionsNode.SelectedImageIndex = 1
        connectionsNode.Tag = presentation.Connections
        BranchConnections(connectionsNode, presentation.Connections)
        connectionsNode = Nothing : i += 1
        '-----------------------------------------
        Dim tablesNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            tablesNode = node.Nodes.Add(GetSystemResource("Collection.Tables"))
        Else
            tablesNode = node.Nodes(i)
            tablesNode.Text = GetSystemResource("Collection.Tables")
        End If
        tablesNode.ImageIndex = 3 : tablesNode.SelectedImageIndex = 3
        tablesNode.Tag = presentation.Tables
        BranchTables(tablesNode, presentation.Tables)
        tablesNode = Nothing : i += 1
        '-----------------------------------------
        Dim relationsNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            relationsNode = node.Nodes.Add(GetSystemResource("Collection.Relations"))
        Else
            relationsNode = node.Nodes(i)
            relationsNode.Text = GetSystemResource("Collection.Relations")
        End If
        relationsNode.ImageIndex = 17 : relationsNode.SelectedImageIndex = 17
        relationsNode.Tag = presentation.Relations
        BranchRelations(relationsNode, presentation.Relations)
        relationsNode = Nothing : i += 1

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchConnections(ByVal node As TreeNode, ByVal connections As Model10.ConnectionCollection)
        Dim i As Integer

        Dim cnn As Model10.Connection
        For Each cnn In connections
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(cnn.Name)
            Else
                tn = node.Nodes(i)
                tn.Text = cnn.Name
            End If
            tn.ImageIndex = 2 : tn.SelectedImageIndex = 2
            tn.Tag = cnn
            tn = Nothing : i += 1
        Next : cnn = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchTables(ByVal node As TreeNode, ByVal tables As Model10.TableCollection)
        Dim i As Integer

        Dim tbl As Model10.Table
        For Each tbl In tables
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(tbl.Name)
            Else
                tn = node.Nodes(i)
                tn.Text = tbl.Name
            End If
            tn.ImageIndex = 4 : tn.SelectedImageIndex = 4
            tn.Tag = tbl
            BranchTable(tn, tbl)
            tn = Nothing : i += 1
        Next : tbl = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchTable(ByVal node As TreeNode, ByVal table As Model10.Table)
        Dim i As Integer

        If Not table.SelectCommand Is Nothing Then
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(GetSystemResource("Command.Select"))
            Else
                tn = node.Nodes(i)
                tn.Text = GetSystemResource("Command.Select")
            End If
            tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
            tn.Tag = table.SelectCommand
            BranchCommand(tn, table.SelectCommand)
            tn = Nothing : i += 1
        End If
        If Not table.InsertCommand Is Nothing Then
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(GetSystemResource("Command.Insert"))
            Else
                tn = node.Nodes(i)
                tn.Text = GetSystemResource("Command.Insert")
            End If
            tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
            tn.Tag = table.InsertCommand
            BranchCommand(tn, table.InsertCommand)
            tn = Nothing : i += 1
        End If
        If Not table.UpdateCommand Is Nothing Then
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(GetSystemResource("Command.Update"))
            Else
                tn = node.Nodes(i)
                tn.Text = GetSystemResource("Command.Update")
            End If
            tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
            tn.Tag = table.UpdateCommand
            BranchCommand(tn, table.UpdateCommand)
            tn = Nothing : i += 1
        End If
        If Not table.DeleteCommand Is Nothing Then
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(GetSystemResource("Command.Delete"))
            Else
                tn = node.Nodes(i)
                tn.Text = GetSystemResource("Command.Delete")
            End If
            tn.ImageIndex = 5 : tn.SelectedImageIndex = 5
            tn.Tag = table.DeleteCommand
            BranchCommand(tn, table.DeleteCommand)
            tn = Nothing : i += 1
        End If
        '-----------------------------------------
        'Dim defaultsNode As TreeNode
        'If i > node.Nodes.Count - 1 Then
        '    defaultsNode = node.Nodes.Add(GetSystemResource("Collection.Defaults"))
        'Else
        '    defaultsNode = node.Nodes(i)
        '    defaultsNode.Text = GetSystemResource("Collection.Defaults")
        'End If
        'defaultsNode.ImageIndex = 8 : defaultsNode.SelectedImageIndex = 8
        'defaultsNode.Tag = table.Defaults
        'BranchDefaults(defaultsNode, table.Defaults)
        'defaultsNode = Nothing : i += 1
        '-----------------------------------------
        Dim computesNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            computesNode = node.Nodes.Add(GetSystemResource("Collection.Computes"))
        Else
            computesNode = node.Nodes(i)
            computesNode.Text = GetSystemResource("Collection.Computes")
        End If
        computesNode.ImageIndex = 10 : computesNode.SelectedImageIndex = 10
        computesNode.Tag = table.Computes
        BranchComputes(computesNode, table.Computes)
        computesNode = Nothing : i += 1
        '-----------------------------------------
        Dim columnsNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            columnsNode = node.Nodes.Add(GetSystemResource("Collection.Columns"))
        Else
            columnsNode = node.Nodes(i)
            columnsNode.Text = GetSystemResource("Collection.Columns")
        End If
        columnsNode.ImageIndex = 12 : columnsNode.SelectedImageIndex = 12
        columnsNode.Tag = table.DataTable.Columns
        BranchColumns(columnsNode, table.DataTable.Columns)
        columnsNode = Nothing : i += 1
        '-----------------------------------------
        Dim constraintsNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            constraintsNode = node.Nodes.Add(GetSystemResource("Collection.Constraints"))
        Else
            constraintsNode = node.Nodes(i)
            constraintsNode.Text = GetSystemResource("Collection.Constraints")
        End If
        constraintsNode.ImageIndex = 14 : constraintsNode.SelectedImageIndex = 14
        constraintsNode.Tag = table.DataTable.Constraints
        BranchConstraints(constraintsNode, table.DataTable.Constraints)
        columnsNode = Nothing : i += 1

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchCommand(ByVal node As TreeNode, ByVal command As Model10.Command)
        Dim i As Integer

        Dim parametersNode As TreeNode
        If i > node.Nodes.Count - 1 Then
            parametersNode = node.Nodes.Add(GetSystemResource("Collection.Parameters"))
        Else
            parametersNode = node.Nodes(i)
            parametersNode.Text = GetSystemResource("Collection.Parameters")
        End If
        parametersNode.ImageIndex = 6 : parametersNode.SelectedImageIndex = 6
        parametersNode.Tag = command.Parameters
        BranchParameters(parametersNode, command.Parameters)
        parametersNode = Nothing : i += 1

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchParameters(ByVal node As TreeNode, ByVal parameters As Model10.ParameterCollection)
        Dim i As Integer

        Dim prm As Model10.Parameter
        For Each prm In parameters
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(prm.Name)
            Else
                tn = node.Nodes(i)
                tn.Text = prm.Name
            End If
            tn.ImageIndex = 7 : tn.SelectedImageIndex = 7
            tn.Tag = prm
            tn = Nothing : i += 1
        Next : prm = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    'Private Sub BranchDefaults(ByVal node As TreeNode, ByVal defaults As Model10.DefaultCollection)
    '    Dim i As Integer

    '    Dim def As Model10.Default
    '    For Each def In defaults
    '        Dim tn As TreeNode
    '        If i > node.Nodes.Count - 1 Then
    '            tn = node.Nodes.Add(def.Name)
    '        Else
    '            tn = node.Nodes(i)
    '            tn.Text = def.Name
    '        End If
    '        tn.ImageIndex = 9 : tn.SelectedImageIndex = 9
    '        tn.Tag = def
    '        tn = Nothing : i += 1
    '    Next : def = Nothing

    '    Dim j As Integer
    '    For j = node.Nodes.Count - 1 To i Step -1
    '        node.Nodes.RemoveAt(j)
    '    Next
    'End Sub
    Private Sub BranchComputes(ByVal node As TreeNode, ByVal computes As Model10.ComputeCollection)
        Dim i As Integer

        Dim cmp As Model10.Compute
        For Each cmp In computes
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(cmp.Name)
            Else
                tn = node.Nodes(i)
                tn.Text = cmp.Name
            End If
            tn.ImageIndex = 11 : tn.SelectedImageIndex = 11
            tn.Tag = cmp
            BranchCommand(tn, cmp)
            tn = Nothing : i += 1
        Next : cmp = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchColumns(ByVal node As TreeNode, ByVal columns As DataColumnCollection)
        Dim i As Integer

        Dim dc As DataColumn
        For Each dc In columns
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(dc.ColumnName)
            Else
                tn = node.Nodes(i)
                tn.Text = dc.ColumnName
            End If
            tn.ImageIndex = 13 : tn.SelectedImageIndex = 13
            tn.Tag = dc
            tn = Nothing : i += 1
        Next : dc = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchConstraints(ByVal node As TreeNode, ByVal constraints As ConstraintCollection)
        Dim i As Integer

        Dim cnt As Constraint
        For Each cnt In constraints
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(cnt.ConstraintName)
            Else
                tn = node.Nodes(i)
                tn.Text = cnt.ConstraintName
            End If
            Select Case cnt.GetType.ToString
                Case "System.Data.UniqueConstraint" : tn.ImageIndex = 15 : tn.SelectedImageIndex = 15
                Case "System.Data.ForeignKeyConstraint" : tn.ImageIndex = 16 : tn.SelectedImageIndex = 16
            End Select
            tn.Tag = cnt
            tn = Nothing : i += 1
        Next : cnt = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub
    Private Sub BranchRelations(ByVal node As TreeNode, ByVal relations As Model10.RelationCollection)
        Dim i As Integer

        Dim rlt As Model10.Relation
        For Each rlt In relations
            Dim tn As TreeNode
            If i > node.Nodes.Count - 1 Then
                tn = node.Nodes.Add(rlt.Name)
            Else
                tn = node.Nodes(i)
                tn.Text = rlt.Name
            End If
            tn.ImageIndex = 18 : tn.SelectedImageIndex = 18
            tn.Tag = rlt
            tn = Nothing : i += 1
        Next : rlt = Nothing

        Dim j As Integer
        For j = node.Nodes.Count - 1 To i Step -1
            node.Nodes.RemoveAt(j)
        Next
    End Sub

    Private Sub FillRelation(ByVal table As Model10.Table)
        Dim tblConst As DataTable = table.SelectCommand.Connection.OleDbConnection.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Foreign_Keys, Nothing)

        Dim rowConst As DataRow
        For Each rowConst In tblConst.Rows
            Dim colParent, colChild As DataColumn
            Dim tblParent, tblChild As Model10.Table

            Dim tbl As Model10.Table
            For Each tbl In table.Presentation.Tables
                Dim col As DataColumn
                For Each col In tbl.DataTable.Columns
                    If col.ColumnName.Trim.ToLower = CStr(rowConst("PK_COLUMN_NAME")).Trim.ToLower Then
                        If tbl.SelectCommand Is Nothing Then
                            colParent = col : tblParent = tbl
                        Else
                            If tbl.SelectCommand.CommandText.Trim.ToLower.IndexOf("select ") = -1 Or tbl.SelectCommand.CommandType = CommandType.TableDirect Then
                                If tbl.SelectCommand.CommandText.Trim.ToLower = CStr(rowConst("PK_TABLE_NAME")).Trim.ToLower Then
                                    colParent = col : tblParent = tbl
                                Else
                                    'colParent = Nothing : tblParent = Nothing
                                End If
                            Else
                                colParent = col : tblParent = tbl
                            End If
                        End If
                    End If
                    If col.ColumnName.Trim.ToLower = CStr(rowConst("FK_COLUMN_NAME")).Trim.ToLower Then
                        If tbl.SelectCommand Is Nothing Then
                            colChild = col : tblChild = tbl
                        Else
                            If tbl.SelectCommand.CommandText.Trim.ToLower.IndexOf("select ") = -1 Or tbl.SelectCommand.CommandType = CommandType.TableDirect Then
                                If tbl.SelectCommand.CommandText.Trim.ToLower = CStr(rowConst("FK_TABLE_NAME")).Trim.ToLower Then
                                    colChild = col : tblChild = tbl
                                Else
                                    'colChild = Nothing : tblChild = Nothing
                                End If
                            Else
                                colChild = col : tblChild = tbl
                            End If
                        End If
                    End If
                Next : col = Nothing
            Next : tbl = Nothing

            If Not colParent Is Nothing And Not colChild Is Nothing Then
                Try
                    Dim rel As New Model10.Relation(CStr(rowConst("FK_NAME")), tblParent, tblChild, New DataColumn() {colParent}, New DataColumn() {colChild})
                    mPresentation.Relations.Add(rel)
                    Select Case CStr(rowConst("DELETE_RULE"))
                        Case "NO ACTION" : rel.DataRelation.ChildKeyConstraint.DeleteRule = Rule.None
                        Case "CASCADE" : rel.DataRelation.ChildKeyConstraint.DeleteRule = Rule.Cascade
                    End Select
                    Select Case CStr(rowConst("UPDATE_RULE"))
                        Case "NO ACTION" : rel.DataRelation.ChildKeyConstraint.UpdateRule = Rule.None
                        Case "CASCADE" : rel.DataRelation.ChildKeyConstraint.UpdateRule = Rule.Cascade
                    End Select
                    rel = Nothing
                Catch ex As Exception
                End Try
            End If
            colParent = Nothing : colChild = Nothing
        Next : rowConst = Nothing

        tblConst = Nothing
    End Sub
    Private Sub UpdateConstraints(ByVal tableNode As TreeNode)
        Dim tn As TreeNode
        For Each tn In tableNode.Nodes
            If TypeOf tn.Tag Is ConstraintCollection Then
                BranchConstraints(tn, CType(tn.Tag, ConstraintCollection))
                Exit For
            End If
        Next : tn = Nothing
    End Sub

    Public Property Changed() As Boolean
        Get
            Return mChanged
        End Get
        Set(ByVal Value As Boolean)
            mChanged = Value

            miFileSave.Enabled = Value
            tbSave.Enabled = Value
        End Set
    End Property
    Public Property Connections() As Model10.ConnectionCollection
        Get
            Return mConnections
        End Get
        Set(ByVal Value As Model10.ConnectionCollection)
            mConnections = Value
        End Set
    End Property
    Public Property EditMode() As Avand.EditMode
        Get
            Return mEditMode
        End Get
        Set(ByVal Value As Avand.EditMode)
            mEditMode = [Global].EditMode.File
        End Set
    End Property
    Public Property Layouts() As ArrayList
        Get
            Return mLayouts
        End Get
        Set(ByVal Value As ArrayList)
            mLayouts = Value
        End Set
    End Property
    Public Property OleDbConnection() As OleDb.OleDbConnection
        Get
            Return mOleDbConnection
        End Get
        Set(ByVal Value As OleDb.OleDbConnection)
            mOleDbConnection = Value
        End Set
    End Property
    Public Property Presentation() As Model10.Presentation
        Get
            Return mPresentation
        End Get
        Set(ByVal Value As Model10.Presentation)
            mPresentation = Value
        End Set
    End Property
    Public Property User() As Model10.User
        Get
            Return mUser
        End Get
        Set(ByVal Value As Model10.User)
            mUser = Value
        End Set
    End Property
    Public Property View() As Form
        Get
            Return mView
        End Get
        Set(ByVal Value As Form)
            mView = Value
        End Set
    End Property

    Public Sub Fill()
        Select Case mEditMode
            Case [Global].EditMode.[New]
                Me.StatusBar1.Text = "<" & GetSystemResource("New") & ">"
            Case [Global].EditMode.File
                Me.StatusBar1.Text = GetSystemResource("File") & ": " & IIf(mPresentation.Path = "", "New", mPresentation.Path).ToString
            Case [Global].EditMode.Node
                Me.StatusBar1.Text = GetSystemResource("Node") & ": " & IIf(mPresentation.Path = "", "New", mPresentation.Path).ToString
        End Select
        Me.Text = GetSystemResource("Presentation.Title") & " - " & IIf(mPresentation.Name = "", "New", mPresentation.Name).ToString

        TreeView1.BeginUpdate()
        '----------------------
        TreeView1.Nodes.Clear()
        Dim tn As TreeNode = TreeView1.Nodes.Add(GetSystemResource("Element.Presentation"))
        tn.ImageIndex = 0 : tn.SelectedImageIndex = 0
        tn.Tag = mPresentation
        BranchPresentation(tn, mPresentation)
        tn.Expand() : tn.Nodes(1).Expand()
        TreeView1.SelectedNode = tn
        tn = Nothing
        '----------------------
        TreeView1.EndUpdate()

        Changed = False
    End Sub

    Public Sub New(ByVal file As String, ByVal presentation As Model10.Presentation)
        MyBase.New()
        InitializeComponent()

        'Me.MdiParent = fMain
        mConnections = New Model10.ConnectionCollection
        mEditMode = [Global].EditMode.File
        mLayouts = New ArrayList
        mOleDbConnection = Nothing
        mPresentation = presentation
        mUser = Nothing

        mPresentation.Id = 0
        mPresentation.Name = IO.Path.GetFileName(file)
        mPresentation.Path = file

        Fill()
    End Sub
    Public Sub New(ByVal itemId As Integer, ByVal oleDbConnection As OleDb.OleDbConnection, ByVal node As String, ByVal presentation As Model10.Presentation, ByVal name As String, ByVal user As Model10.User, ByVal connections As Model10.ConnectionCollection)
        MyBase.New()
        InitializeComponent()

        'Me.MdiParent = fMain
        mConnections = connections
        mEditMode = [Global].EditMode.Node
        mLayouts = New ArrayList
        mOleDbConnection = oleDbConnection
        mPresentation = presentation
        mUser = user

        mPresentation.Id = itemId
        mPresentation.Name = name
        mPresentation.Path = node

        Fill()
    End Sub

    Private Sub Presentation_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'TinyErrorMessage()
    End Sub
End Class